package com.Thread02.demo04;

import java.util.concurrent.*;

import static java.util.concurrent.ThreadPoolExecutor.*;

public class Demo01 {
    public static void main(String[] args) {
        ThreadPoolExecutor poo = new ThreadPoolExecutor(2, 5, 2, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());

        for (int x = 0; x < 10; x++) {
            poo.submit(() -> {
                System.out.println(Thread.currentThread().getName() + "...执行了");
            });
        }
    }
}
